package com.wswy.wzcx.model.news;

import android.os.Parcel;
import com.google.gson.annotations.SerializedName;

public class NewsCategory implements android.os.Parcelable {

  @SerializedName("pinyin_abbr")
  public String type;

  @SerializedName("name")
  public String name;

  @Override
  public int describeContents() {
    return 0;
  }

  @Override
  public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(this.type);
    dest.writeString(this.name);
  }

  public NewsCategory() {
  }

  public NewsCategory(String type, String name) {
    this.type = type;
    this.name = name;
  }

  protected NewsCategory(Parcel in) {
    this.type = in.readString();
    this.name = in.readString();
  }

  public static final Creator<NewsCategory> CREATOR = new Creator<NewsCategory>() {
    @Override
    public NewsCategory createFromParcel(Parcel source) {
      return new NewsCategory(source);
    }

    @Override
    public NewsCategory[] newArray(int size) {
      return new NewsCategory[size];
    }
  };

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }

    NewsCategory category = (NewsCategory) o;

    if (type != null ? !type.equals(category.type) : category.type != null) {
      return false;
    }
    return name != null ? name.equals(category.name) : category.name == null;
  }

  @Override
  public int hashCode() {
    int result = type != null ? type.hashCode() : 0;
    result = 31 * result + (name != null ? name.hashCode() : 0);
    return result;
  }
}
